<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="${#request.getContextPath() + '/'}">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>客房价格</title>
    <!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
    <!-- Reset Stylesheet -->
    <link rel="stylesheet" href="resources/css/reset.css" type="text/css"
          media="screen" />
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="resources/css/style.css" type="text/css"
          media="screen" />
    <link rel="stylesheet" href="resources/css/invalid.css" type="text/css"
          media="screen" />

    <!--                       Javascripts                       -->
    <!-- jQuery -->
    <script type="text/javascript"
            src="resources/scripts/jquery-1.8.3.min.js"></script>
    <!-- jQuery Configuration -->
    <script type="text/javascript"
            src="resources/widget/dialog/jquery-ui-1.9.2.custom.min.js"></script>
    <link rel="stylesheet" href="resources/widget/dialog/jquery-ui.min.css" type="text/css"
          media="screen" />
    <script type="text/javascript"
            src="resources/scripts/simpla.jquery.configuration.js"></script>
    <script>
        //打开弹出框
        function openDialog(rpid, rid, date, price, type){
            $("#rpid").val(rpid);
            $("#date").html(date);
            $("#price").val(price);
            $("#rid").val(rid);
            $("[name='type'][type='radio'][value='" + type + "']").attr("checked", true);

            $("#price_dialog").dialog({
                title: "调整价格",
                width: 500,
                height: 400,
                modal: true
            });
        }
    </script>
</head>
<body>
<div id="price_dialog" style="display: none;">
    <div class="tab-content default-tab" id="tab2">
        <form action="/system/updatepirce" method="post">
            <input id="rpid" name="id" type="hidden"/>
            <input id="rid" name="rid" type="hidden"/>
            <fieldset>
                <p>
                    <label>日期：</label> <span id="date"></span>
                </p>
                <p>
                    <label>价格：</label> <input
                        class="text-input small-input" type="text" id="price"
                        name="price" />
                </p>
                <p>
                    <label>类型：</label> <input name="type" type="radio" value="0"/>普通 <input name="type" type="radio" value="1"/>特价
                </p>
                <p>
                    <input class="mybutton" type="submit" value="提交" />
                </p>
            </fieldset>
            <div class="clear"></div>
            <!-- End .clear -->
        </form>
    </div>
</div>
<div id="main-content">
    <div class="content-box">
        <!-- End .content-box-header -->
        <div class="content-box-content">
            <div class="tab-content default-tab" id="tab1">
                <table>
                    <thead>
                    <tr>
                        <td><input class="check-all" type="checkbox" /></td>
                        <th>编号</th>
                        <th>客房编号</th>
                        <th>日期</th>
                        <th>价格</th>
                        <th>类型</th>
                        <th>已预定数量</th>
                        <th>剩余数量</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="price : ${roomPriceList}">
                        <td><input class="check-all" type="checkbox" /></td>
                        <td th:text="${price.id}"></td>
                        <td th:text="${price.rid}"></td>
                        <td th:text="${#dates.format(price.date,'yyyy-MM-dd')}"></td>
                        <td th:text="${price.price}"></td>
                        <td th:text="${price.type == 0 ? '普通':'特价'}"></td>
                        <td th:text="${price.number}"></td>
                        <td th:text="${price.hasNumber}"></td>
                        <td>
                            <button class="mybutton" type="button" th:onclick="openDialog([[${price.id}]], [[${price.rid}]], [[${#dates.format(price.date, 'yyyy-MM-dd')}]], [[${price.price}]], [[${price.type}]]);">修改</button>
                        </td>
                    </tr>
                    </tbody>
                    <tfoot>
                    <tr>
                        <td colspan="6">
                            <div class="pagination">
                                <a href="#" title="First Page">&laquo; First</a>
                                <a href="#" title="Previous Page">&laquo; Previous</a>
                                <a href="#" class="number" title="1">1</a>
                                <a href="#" title="Next Page">Next &raquo;</a>
                                <a href="#" title="Last Page">Last &raquo;</a>
                            </div>
                            <div class="clear"></div>
                        </td>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
        <!-- End .content-box-content -->
    </div>
</div>


<!-- End #main-content -->
</body>
</html>